package com.mall.dao;

import com.mall.domain.Cart;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ICartDao {
    //第一次加入购物车
    @Insert("insert into tb_cart values(default,#{goods_id},#{goods_name},#{num},#{goods_price},#{goods_small_logo},#{checked})")
    void addCart(Cart cart);

    //多次以后加入购物车/修改购物车商品数量，选中状态
    @Update("update tb_cart set num=#{num} where cart_id=#{cart_id}")
    void addCartNum(Cart cart);

    //删除购物车商品
    @Delete("delete from tb_cart where cart_id=#{cart_id}")
    void deleteCartGoods(Cart cart);

    @Delete("delete from tb_cart where goods_id=#{goods_id}")
    void deleteCartGoods1(Cart cart);

    //展示购物车中商品数据
    @Select("select * from tb_cart")
    List<Cart> showCart();


}

















